import service from "./request";

//手机登录
export const Loginphone = (data) => {
  return service({
    method: "post",
    url: `login/cellphone?phone=${encodeURIComponent(
      data.phone
    )}&password=${encodeURIComponent(data.password)}`,
    data,
  });
};
//获取验证码
export const Getyzm = (data) => {
  return service({
    method: "post",
    url: "captcha/sent",
    data: {
      phone: data,
      ctcode: 86,
    },
  });
};

//验证验证码
export const Verify = (data) => {
  return service({
    method: "post",
    url: "/captcha/verify",
    data: {
      phone: data.phone,
      captcha: data.yzm,
      ctcode: 86,
    },
  });
};


//游客登录
export const YKLogin = (data) => {
  return service({
    method: "get",
    url: "register/anonimous",
  });
};
//邮箱登录
export const EmailLogin = (data) => {
  return service({
    method: "post",
    url: "login",
    data,
  });
};

//二维码登录
//先获取二维码的key
export const Gettwo = (data) => {
  return service({
    method: "get",
    url: "login/qr/key",
    data,
  });
};
//  获取二维码图片
export const Gettwoimg = (data) => {
  return service({
    method: "post",
    url: `/login/qr/create?key=${data.key}`,
    data: {
      key: data.key,
      qrimg: data.qrimg,
    },
  });
};

//e检测二维码状态
export const Checktwo = (data) => {
  return service({
    method: "get",
    url: '/login/qr/check',
    params:{
      key:data.key
    }
  });
}


